package cn.genmer.test.security.designpatterns.decorator.order;

import cn.genmer.test.security.designpatterns.decorator.Drink;
import cn.genmer.test.security.designpatterns.decorator.mydecorator.Honey;
import cn.genmer.test.security.designpatterns.decorator.mydecorator.Pearl;
import cn.genmer.test.security.designpatterns.decorator.mydecorator.RedBean;
import cn.genmer.test.security.designpatterns.decorator.mydrink.MilkTea;

/**
 * 点单测试类   https://www.bilibili.com/video/BV1G4411c7N4?p=74
 */
public class Order {
    public static void main(String[] args) {
        // 装饰者模式下，点2份珍珠+1分红豆+1被奶茶

        // 1.先点一杯奶茶，先查看信息
        Drink milkTea = new MilkTea();
        System.out.println("一杯奶茶的价格：" + milkTea.cost());
        System.out.println("商品名称：" + milkTea.getName());

//        // 2.加一份珍珠
//        Drink order =  new Pearl(milkTea);
//        System.out.println("一杯奶茶+一份珍珠的价格：" + order.cost());
//        System.out.println("商品名称：" + order.getName());
//        // 3.加一份珍珠
//        order =  new Pearl(order);
//        System.out.println("一杯奶茶+两份珍珠的价格：" + order.cost());
//        System.out.println("商品名称：" + order.getName());
//        // 4.加一份红豆
//        order =  new RedBean(order);
//        System.out.println("一杯奶茶+两份珍珠+一份红豆的价格：" + order.cost());
//        System.out.println("商品名称：" + order.getName());

//        Drink drink = new MilkTea();
        Drink order2 = new Honey(milkTea);
        System.out.println("一杯奶茶+一份蜂蜜的价格：" + order2.cost());
        System.out.println("商品名称：" + order2.getName());
    }
}
